<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>EditInPlace 哔哩哔哩用户体验打造</title>
</head>
<body>
  <div id="app">
    <div id="ep1">
      <span id="content">男德学院一等奖学金获得者</span>
      <input type="text" id="input" value="男德学院一等奖学金获得者">
      <input type="button" id="save" value="Save">
      <input type="button" id="cancel" value="Cancel">
    </div>
  </div>
  <script>
    //dom js html 节点对象 动态操作html
  const content = document.getElementById('content');
  const input = document.getElementById('input');
  const save = document.getElementById('save');
  const cancel = document.getElementById('cancel');
  function convertToText() {
    input.style.display  = 'none';
    save.style.display  = 'none';
    cancel.style.display  = 'none';
  }
  // 文本 编辑状态
  function convertToEdit() {
    input.style.display  = 'inline';
    save.style.display  = 'inline';
    cancel.style.display  = 'inline';
    content.style.display = 'lnline'
    content.style.display = 'none'
  }// 点击取消按钮 取消编辑内容
  cancel.addEventListener('click', function() {
    convertToText();
  });

  convertToText();
  content.addEventListenter('click',function(){
    converToEdit();
    // 输入框里面最新的签名
    input.value = content.innerText;
  })
  
  
  </script>
</body>
</html>